package DSL

class BuyFood {
    def name
    def size
    def num
    def price
    def remark
    static void main(String[] args) {
        def food = new BuyFood()
        //with：使用上下文
        food.with {
            setName "大盘鸡"  //只写名字即可
            setSize "大份"
            setNum 2
            setPrice 60
            setRemark "少放辣椒"
        }
        println food
    }
    @Override
    public String toString() {
        return "BuyFood{" +
                "name=" + name +
                ", size=" + size +
                ", num=" + num +
                ", price=" + price +
                ", remark=" + remark +
                '}';
    }
}
